package com.nt.train.annoreflect;

/**
 * 主要的牌子
 * @author hlf
 * @version 1.0
 * @date 2022/8/11 15:03
 */
public class MainBoard {

    @NTBean(IntelCPU.class) // 依赖注入
    private CPU cpu;

    private GraphicsCard graphicsCard;

    @NTBean(NVIDIACard.class) // 依赖注入
    public void setGraphicsCard(GraphicsCard graphicsCard) {
        this.graphicsCard = graphicsCard;
    }

    // 验证对象是否自动创建,依赖注入
    public void run() {
        System.out.println("Starting computer...");
        cpu.calculate();
        graphicsCard.display();
    }
}